<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
$currentLanguage = Yii::app()->language;
?>

<div id="content" class="clearfix">
<div class="top-wrapper">
    <div class="top">
        <div class="top-inner">
            <div class="map-wrapper">
                <div class="container">
                    <div class="row">
                        <div class="span3">

                            <div class="property-filter widget">
                                <div class="content">
                                    <form method="get" action="/property/filter/">
                                        <div class="location control-group">
                                            <label class="control-label" for="inputLocation-">
                                                <?php echo Yii::t('main', 'Location') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_location" id="inputLocation-">
                                                    <option value>-</option>
                                                    <option value="6">Palo Alto, SA</option>
                                                    <option value="7">Silicon Valley, SA</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div><!-- /.control-group -->

                                        <div class="type control-group">
                                            <label class="control-label" for="inputType-">
                                                <?php echo Yii::t('main', 'Type') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_type" id="inputType-">
                                                    <option value>-</option>
                                                    <option value="51">Apartment</option>
                                                    <option value="2">Building Area</option>
                                                    <option value="3">Condo</option>
                                                    <option value="4">Cottage</option>
                                                    <option value="5">Family House</option>
                                                    <option value="49">Single Home</option>
                                                    <option value="50">Villa</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div>
                                        <!-- /.control-group -->

                                        <div class="beds control-group">
                                            <label class="control-label" for="inputBeds-">
                                                <?php echo Yii::t('main', 'Beds') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_bedrooms" id="inputBeds-">
                                                    <option value>-</option>
                                                    <option value="1">1</option>
                                                    <option value="2">2</option>
                                                    <option value="3">3</option>
                                                    <option value="4">4</option>
                                                    <option value="5">5</option>
                                                    <option value="6">6</option>
                                                    <option value="7">7</option>
                                                    <option value="8">8</option>
                                                    <option value="9">9</option>
                                                    <option value="10">10</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div>
                                        <!-- /.control-group -->

                                        <div class="baths control-group">
                                            <label class="control-label" for="inputBaths-">
                                                <?php echo Yii::t('main', 'Baths') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_bathrooms" id="inputBaths-">
                                                    <option value>-</option>
                                                    <option value="1">1</option>
                                                    <option value="2">2</option>
                                                    <option value="3">3</option>
                                                    <option value="4">4</option>
                                                    <option value="5">5</option>
                                                    <option value="6">6</option>
                                                    <option value="7">7</option>
                                                    <option value="8">8</option>
                                                    <option value="9">9</option>
                                                    <option value="10">10</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div>
                                        <!-- /.control-group -->


                                        <div class="price-from control-group">
                                            <label class="control-label" for="inputPriceFrom-">
                                                <?php echo Yii::t('main', 'Price From') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_price_from" id="inputPriceFrom-">
                                                    <option value>-</option>
                                                    <option value="1000">1000 €</option>
                                                    <option value="20000">20000 €</option>
                                                    <option value="50000">50000 €</option>
                                                    <option value="100000">100000 €</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div>
                                        <!-- /.control-group -->

                                        <div class="price-to control-group">
                                            <label class="control-label" for="inputPriceTo-">
                                                <?php echo Yii::t('main', 'Price To') ?>
                                            </label>

                                            <div class="controls">
                                                <select name="filter_price_to" id="inputPriceTo-">
                                                    <option value>-</option>
                                                    <option value="1000">1000 €</option>
                                                    <option value="20000">20000 €</option>
                                                    <option value="50000">50000 €</option>
                                                    <option value="100000">100000 €</option>
                                                </select>
                                            </div>
                                            <!-- /.controls -->
                                        </div>
                                        <!-- /.control-group -->



                                        <div class="control-group">
                                            <label class="control-label" for="inputPropertyId-">
                                                <?php echo Yii::t('main', 'Property ID') ?>
                                            </label>

                                            <div class="controls">
                                                <input type="text" value name="filter_property_id" id="inputPropertyId-">
                                            </div><!-- /.controls -->
                                        </div><!-- /.control-group -->

                                        <div class="form-actions">
                                            <button class="btn btn-primary btn-large"><?php echo Yii::t('main', 'Filter now!') ?></button>
                                        </div>
                                        <!-- /.form-actions -->
                                    </form>
                                </div>
                                <!-- /.content -->
                            </div><!-- /.property-filter -->
                        </div>
                        <!-- /.span3 -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.container -->

                <div class="map">
<?php
$coordinates='';
$types='';
$content='';
foreach ($dataProp as $property){
    $coordinates.='['.$property['latitude'].', '.$property['longitude'].'], ';
    $types.='\''.$property['type'].'\', ';
    $content.='\'<div class="infobox"><div class="close"><img src="/img/close.png" alt=""></div><div class="image"><a href="/"><img width="80" height="59" src="/uploads/'.$property['id'].'/thumb_270/'.$property['image'].'" class="attachment-admin-thumb wp-post-image" alt="property-small-2" /></a></div><div class="title">'.CHtml::link($property['name_'.$currentLanguage], array('/site/property/id/'.$property['id'])).'</div><div class="area"><span class="key">Area:</span><span class="value">'.$property['area'].'m<sup>2</sup></span></div><div class="price">'.$property['price'].' € / day</div><div class="link">'.CHtml::link('View more', array('/site/property/id/'.$property['id'])).'</div></div>\', ';
}
$coordinates=substr($coordinates, 0, -2);$types=substr($types, 0, -2);$content=substr($content, 0, -2);
?>
                    <script type="text/javascript">
                        jQuery(document).ready(function ($) {
                            var map = $('#map').aviators_map({
                                locations              : new Array(<?php echo $coordinates; ?>),
                                types                  : new Array(<?php echo $types; ?>),
                                contents               : new Array(<?php echo $content; ?>),
                                transparentMarkerImage : '/img/marker-transparent.png',
                                transparentClusterImage: '/img/cluster-transparent.png',
                                zoom                   : 13,
                                center                 : {
                                    latitude : 34.700119,
                                    longitude: 33.098995
                                },
                                filterForm             : '.map-filtering',
                                enableGeolocation      : ''
                            });
                        });
                    </script>

                    <div id="map" class="map-inner" style="height: 480px"></div>
                    <!-- /.map-inner -->

                </div>
                <!-- /.map -->
            </div><!-- /.map-wrapper --><div id="rev-slider-widget-2" class="widget widget_revslider"></div>        </div><!-- /.top-inner -->
    </div><!-- /.top -->
</div><!-- /.top-wrapper -->

<div class="container">
<div class="row">



<div id="main" class="span9">


<h1 class="page-header"><?php echo Yii::t('main', 'Recent Properties') ?></h1>

<div class="properties-grid">


<?php
$counter=0;
$endofDataProp=end($dataProp);
foreach($dataProp as $property){
    $counter++;
    if($counter==1){
        echo'<div class="row">';
        $endRow='';
    }elseif($counter==3){
        $endRow='</div>';
        $counter=0;
    }else $endRow='';
    if($property['status']==0) $status='Sold';elseif($property['status']==1) $status='Sale';elseif($property['status']==2) $status='Rent';else $status='?';
    echo'
    <div class="span3">
        <div class="property">
            <div class="image">
                <div class="content">
                    '.CHtml::link('', array('/site/property/id/'.$property['id'])).'
                    <img src="/uploads/'.$property['id'].'/thumb_270/'.$property['image'].'" alt="">
                </div><!-- /.content -->
                <div class="rent-sale">
                    '.$status.'
                </div><!-- /.rent-sale -->
                <div class="price">
                    '.$property['price'].' €
                </div><!-- /.price -->
            </div>
            <!-- /.image -->
            <div class="title">
                <h2>'.CHtml::link($property['name_'.$currentLanguage], array('/site/property/id/'.$property['id'])).'
                    </h2>
            </div>
            <!-- /.title -->
            <div class="location">'.$property['location'].'</div>
            <!-- /.location -->
            <div class="area">
                <span class="key">Area:</span><!-- /.key -->
                <span class="value">'.$property['area'].'m<sup>2</sup></span><!-- /.value -->
            </div><!-- /.area -->
            <div class="bathrooms" title="Bathrooms">
                <div class="content">'.$property['bath'].'</div>
            </div><!-- /.bathrooms -->
            <div class="bedrooms" title="Bedrooms">
                <div class="content">'.$property['beds'].'</div>
            </div><!-- /.bedrooms -->
        </div>
    </div>';
    if($property['id'] == $endofDataProp['id']&&$endRow==''){
        echo'</div>';
    }
    echo $endRow;
}
?>
<div class="row">
</div>
<!-- /.row -->
</div><!-- /.properties-grid -->            </div><!-- /#main -->

<div class="sidebar span3">

    <div id="agents_widget-2" class="widget our-agents">

        <h2><?php echo Yii::t('main', 'Agents') ?></h2>

        <div class="content">
            <div class="agent clearfix">
                <div class="image">
                    <a href="#">
                        <img width="140" height="141" src="/img/john-sma.png" class="attachment-post-thumbnail wp-post-image" alt="john-small">
                    </a>
                </div>
                <!-- /.image -->

                <div class="name">
                    <a href="#">John Connor</a>
                </div>
                <!-- /.name -->
                <div class="phone">666-999-888</div>
                <!-- /.phone -->
                <div class="email"><a href="mailto:connor@example.com">connor@example.com</a>
                </div>
                <!-- /.email -->
            </div><!-- /.agent -->
            <div class="agent clearfix">
                <div class="image">
                    <a href="http://wp.realia.byaviators.com/agents/martin-crane/">
                        <img width="140" height="141" src="/img/emma-sma.png" class="attachment-post-thumbnail wp-post-image" alt="emma-small">
                    </a>
                </div>
                <!-- /.image -->

                <div class="name">
                    <a href="http://wp.realia.byaviators.com/agents/martin-crane/">Sarah Connor</a>
                </div>
                <!-- /.name -->
                <div class="phone">222-333-444</div>
                <!-- /.phone -->
                <div class="email"><a href="mailto:martin@example.com">martin@example.com</a>
                </div>
                <!-- /.email -->
            </div><!-- /.agent -->
            <div class="agent clearfix">
                <div class="image">
                    <a href="#">
                        <img width="140" height="141" src="/img/john-sma.png" class="attachment-post-thumbnail wp-post-image" alt="john-small">
                    </a>
                </div>
                <!-- /.image -->

                <div class="name">
                    <a href="#">John Doe</a>
                </div>
                <!-- /.name -->
                <div class="phone">000-222-333</div>
                <!-- /.phone -->
                <div class="email"><a href="mailto:john@example.com">john@example.com</a>
                </div>
                <!-- /.email -->
            </div><!-- /.agent -->
        </div><!-- /.content -->

    </div>
    <div id="featuredproperties_widget-4" class="widget properties">

        <h2><?php echo Yii::t('main', 'Featured') ?></h2>

        <div class="content">


            <?php
            $rectntProperty=(Controller::recentPropertyes());
            foreach ($rectntProperty as $property){
                echo'
                            <div class="property">
                                <div class="image">
                                    <a href="/site/property/id/'.$property['id'].'"></a>
                                    <img src="/uploads/'.$property['id'].'/thumb_240/'.$property['image'].'" alt="3412 Cloudcroft Dr">
                                </div>
                                <div class="wrapper">
                                    <div class="title">
                                        <h3><a href="/site/property/id/'.$property['id'].'">
                                                '.$property['name_'.$this->currentLanguage].'
                                            </a></h3>
                                    </div>
                                    <div class="location">'.$property['location'].'</div>
                                    <div class="price">
                                        '.$property['price'].' €                                             </div>
                                </div>
                            </div>
                                ';
            }
            ?>
        </div><!-- /.content -->

    </div>

</div><!-- /#sidebar -->
</div><!-- /.row -->

<div class="content-bottom-wrapper">
<div class="content-bottom">
<div class="content-bottom-inner">
<div id="carouselproperties_widget-2" class="widget property-carousel">

<div class="carousel">
<h2><?php echo Yii::t('main', 'All properties') ?></h2>

<div class="content">
<a class="carousel-prev">Previous</a>
<a class="carousel-next">Next</a>

<ul class="properties-grid unstyled">
<?php
foreach ($allProperty as $carousel){
    if($carousel['status']==0) $status='Sold';elseif($carousel['status']==1) $status='Sale';elseif($carousel['status']==2) $status='Rent';else $status='?';
    echo'
        <li>
            <div class="property">
                <div class="image">
                    <div class="content">
                        <a href="/site/property/id/'.$carousel['id'].'"></a>
                        <img src="/uploads/'.$carousel['id'].'/thumb_270/'.$carousel['image'].'" alt="26600 Ocean View">
                    </div><!-- /.content -->
                    <div class="rent-sale">
                        '.$status.'
                    </div><!-- /.rent-sale -->
                    <div class="price">
                        '.$carousel['price'].' €
                    </div><!-- /.price -->
                </div>
                <!-- /.image -->
                <div class="title">
                    <h2><a href="/site/property/id/'.$carousel['id'].'">
                            26600 Ocean View
                        </a></h2>
                </div>
                <!-- /.title -->
                <div class="location">'.$carousel['location'].'</div>
                <!-- /.location -->
                <div class="area">
                    <span class="key">Area:</span><!-- /.key -->
                    <span class="value">'.$carousel['area'].'m<sup>2</sup></span><!-- /.value -->
                </div><!-- /.area -->
                <div class="bathrooms" title="Bathrooms">
                    <div class="content">'.$carousel['bath'].'</div>
                </div><!-- /.bathrooms -->
                <div class="bedrooms" title="Bedrooms">
                    <div class="content">'.$carousel['beds'].'</div>
                </div><!-- /.bedrooms -->
            </div>                    </li>
        ';
}
?>
</ul>
</div>
<!-- /.content -->
</div><!-- /.carousel -->

</div><div id="text-7" class="widget widget_text"><h2><?php echo Yii::t('main', 'We offer') ?></h2>			<div class="textwidget"><div class="row">
            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/features.png" alt="Responsive">
                        </div>


                        <div class="content span3">
                            <h3>Responsive</h3>

                            Realia is ready to put your website on higher ranks. Every line of code was developed with SEO principles in mind.
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>

            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/featuret.png" alt="Retina Ready">
                        </div>


                        <div class="content span3">
                            <h3>Retina Ready</h3>

                            Realia looks great even on Retina and high-resoultion displays. Every graphic element is sharp and clean. No blurry images anymore!
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>

            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/featureu.png" alt="SEO Ready">
                        </div>


                        <div class="content span3">
                            <h3>SEO Ready</h3>

                            Realia is ready to put your website on higher ranks. Every line of code was developed with SEO principles in mind.
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>
        </div>

        <div class="row">
            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/featurev.png" alt="Custom Widgets">
                        </div>


                        <div class="content span3">
                            <h3>Custom Widgets</h3>

                            Realia is ready to put your website on higher ranks. Every line of code was developed with SEO principles in mind.
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>

            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/featurew.png" alt="Frontend Submission">
                        </div>


                        <div class="content span3">
                            <h3>Frontend Submission</h3>

                            Make the portal solution from your real estate by providing property submission on homepage.
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>

            <div class="span4"><div class="content-box">
                    <div class="row">
                        <div class="icon span1">
                            <img src="/img/featurex.png" alt="Prepared for Bootstrap">
                        </div>


                        <div class="content span3">
                            <h3>Prepared for Bootstrap</h3>

                            Developer friendly code based on Bootstrap and SASS makes your own customizations really easy.
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.row -->
                </div><!-- /.content-box --></div>
        </div></div>
</div><div id="partners_widget-2" class="widget partners">

    <h2>Partners</h2>

    <div class="partners">
        <div class="row">
            <div class="span3">
                <div class="partner">
                    <a href="http://www.themeforest.net/">
                        <img width="270" height="70" src="/img/themefor.png" class="attachment-post-thumbnail wp-post-image" alt="themeforest">
                    </a>
                </div>
            </div><!-- /.span3 -->
            <div class="span3">
                <div class="partner">
                    <a href="http://www.activeden.net/">
                        <img width="270" height="70" src="/img/activede.png" class="attachment-post-thumbnail wp-post-image" alt="activeden">
                    </a>
                </div>
            </div><!-- /.span3 -->
            <div class="span3">
                <div class="partner">
                    <a href="http://www.3docean.net/">
                        <img width="270" height="70" src="/img/3docean0.png" class="attachment-post-thumbnail wp-post-image" alt="3docean">
                    </a>
                </div>
            </div><!-- /.span3 -->
            <div class="span3">
                <div class="partner">
                    <a href="http://www.codecanyon.net/">
                        <img width="270" height="70" src="/img/code-can.png" class="attachment-post-thumbnail wp-post-image" alt="code-canyon">
                    </a>
                </div>
            </div><!-- /.span3 -->
        </div><!-- /.row -->
    </div><!-- /.partners -->
</div>		</div><!-- /.content-bottom-inner -->
</div><!-- /.content-bottom -->
</div><!-- /.content-bottom-wrapper -->
</div><!-- /.container -->

</div><!-- /#content -->


</div><!-- /#wrapper-inner -->

<div class="bottom-wrapper">
    <div class="bottom container">
        <div class="bottom-inner row">
            <div class="span4">
                <div id="calltoaction_widget-4" class="widget call-to-action">

                    <a class="address decoration" href="http://wp.realia.byaviators.com/properties/"></a>

                    <h2>Listing</h2>

                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan dui ac nunc imperdiet rhoncus. Aenean vitae imperdiet lectus</p>

                    <a href="http://wp.realia.byaviators.com/properties/" class="btn btn-primary">Read more</a>

                </div>                                    </div>

            <div class="span4">
                <div id="calltoaction_widget-6" class="widget call-to-action">

                    <a class="gps decoration" href="http://wp.realia.byaviators.com/properties/"></a>

                    <h2>Advertise</h2>

                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan dui ac nunc imperdiet rhoncus. Aenean vitae imperdiet lectus</p>

                    <a href="http://wp.realia.byaviators.com/properties/" class="btn btn-primary">Read more</a>

                </div>                                    </div>

            <div class="span4">
                <div id="calltoaction_widget-5" class="widget call-to-action">

                    <a class="key decoration" href="http://wp.realia.byaviators.com/properties/"></a>

                    <h2>Guidance</h2>

                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan dui ac nunc imperdiet rhoncus. Aenean vitae imperdiet lectus</p>

                    <a href="http://wp.realia.byaviators.com/properties/" class="btn btn-primary">Read more</a>

                </div>                                    </div>
        </div><!-- /.bottom-inner -->
    </div><!-- /.bottom -->
</div><!-- /.bottom-wrapper -->